﻿using LiteDB;

public class DBCore : IDisposable
{
    public LiteDatabase LiteDatabase { get; }

    public DBCore(string dbConnectionString)
    {
        LiteDatabase = new(dbConnectionString);
    }

    protected ILiteCollection<T> GetCollection<T>()
    {
        return LiteDatabase.GetCollection<T>(BsonAutoId.Int32);
    }

    ~DBCore()
    {
        Dispose();
    }

    public void Dispose()
    {
        LiteDatabase?.Dispose();
        GC.SuppressFinalize(this);
    }



}
